<script>
export default {
  name: "NotificationPage",
  data() {
    return { notifications: [] };
  },
  async mounted() {
    await this.loadNotifications();
  },
  methods: {
    async loadNotifications() {
      if (!this.$store.state.user) return;
      const res = await this.$axios.get(`/notification/list?userId=${this.$store.state.user.no}`);
      if (res.data.code === 200) {
        this.notifications = res.data.data.map(n => ({
          ...n,
          adoptTime: new Date(n.adoptTime).toLocaleString() // 格式化时间
        }));
      }
    }
  }
}
</script>

<template>
  <div class="notification-list">
    <el-card v-for="note in notifications" :key="note.id">
      <div :class="['status', note.status]">
        {{ note.status === 'approved' ? '✅ 通过' : '❌ 拒绝' }}
      </div>
      <div class="content">{{ note.feedback }}</div>
      <div class="time">{{ note.createTime }}</div>
    </el-card>
  </div>
</template>

<style scoped>

</style>
